/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package compilador.analisadorSintatico.operacoes;

import compilador.analisadorLexico.Token;
import compilador.analisadorLexico.TokenClass;
import compilador.analisadorSintatico.Producao;
import compilador.analisadorSintatico.TokenReader;
import compilador.analisadorSintatico.simboloGramatical.NaoTerminal;
import compilador.analisadorSintatico.simboloGramatical.SimboloGramatical;

/**
 *
 * @author Joao
 */
class EXP_ARIT_X extends Producao
{

    //<EXP_ARIT_X> ::= [<OP_SOMA> <TERMO> <EXP_ARIT_X>]
    @Override
    public void setSimbolo() {
        this.simbolo = new NaoTerminal(this.getClass().getSimpleName());
    }

    @Override
    public SimboloGramatical derivar() throws Exception
    {
        TokenReader tokenReader =  TokenReader.getInstance();

        

        Token t = tokenReader.seeCurrent();
        if(t.getTokenClass().equals(TokenClass.OPERADOR) &&
            (t.getAtributo().toString().equals("+") || t.getAtributo().toString().equals("-")))
        {
            
            ((NaoTerminal)  this.simbolo).add(new OP_SOMA().derivar());

            
            ((NaoTerminal)  this.simbolo).add(new TERMO().derivar());

            
            ((NaoTerminal)  this.simbolo).add(new EXP_ARIT_X().derivar());
        }

        return ((NaoTerminal)  this.simbolo);
    }

}
